package com.example.dllo.baidumusic.fragment;
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         佛祖保佑       永无BUG
*/

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.dllo.baidumusic.R;
import com.example.dllo.baidumusic.bean.MusicBean;
import com.example.dllo.baidumusic.events.SingInfoEvent;
import com.example.dllo.baidumusic.nettool.BaseFragment;
import com.example.dllo.baidumusic.nettool.LrcParser;
import com.example.dllo.baidumusic.nettool.NetTool;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by dllo on 16/8/27.
 */
public class LrcFragment extends BaseFragment {
    private TextView lrc;
    private String lrcPath;
    private ImageView pic;

    @Override
    protected int setLayout() {
        return R.layout.fragment_playinglrc;
    }

    @Override
    protected void initView() {
        pic = bindView(R.id.my_giftpic);

    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventBus.getDefault().register(this);
        EventBus.getDefault().post(new SingInfoEvent());
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void getMusicInfo(MusicBean musicBean) {
//        lrc.setText(musicBean.getLrcUrl());
        lrcPath = musicBean.getLrcUrl();
    }


    @Override
    protected void initData() {

        LrcParser lrcParser = new LrcParser();
        try {
            lrcParser.parser(lrcPath);
        } catch (Exception e) {
            e.printStackTrace();

        }
//        lrc.setText(lrcPath);
    }

}
